commit: filter out selinux label before commit
authorJonathan Lebon <jlebon@redhat.com>
Wed, 30 Aug 2017 19:20:31 +0000 (15:20 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 31 Aug 2017 12:07:46 +0000 (12:07 +0000)
commit12114ce3828936ed170adaa71a4c6e948764b127
tree1f67a67ac36b1c1f8310ef8918a3ddec4c7b13ed
parent93d2590c35c6e302c52a4bfce23712a06ed732f2
commit: filter out selinux label before commit

The new --selinux-policy added in [0] exposed a subtle issue in the way
we handle labeling during commit. The CI system in rpm-ostree hit this
when trying to make use of it[1].

Basically, because of the way we use a GVariant to represent xattrs, if
a file to be committed already has an SELinux label, the xattr object
ends up with *two* label entries. This of course throws off fsck later
on, since the checksum will have gone over both entries, even though the
on-disk file will only have a single label (in which the second entry
wins).

I confirmed that the `fsck` added in the installed test fails without
the rest of this patch.

[0] https://github.com/ostreedev/ostree/pull/1114
[1] https://github.com/projectatomic/rpm-ostree/pull/953

Closes: #1121
Approved by: cgwalters
src/libostree/ostree-repo-commit.c
tests/installed/itest-label-selinux.sh